<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual describes GNU Stow version 2.3.1
(28 July 2019), a program for managing farms of symbolic links.

Software and documentation is copyrighted by the following:

(C) 1993, 1994, 1995, 1996 Bob Glickstein <bobg+stow@zanshin.com>


(C) 2000, 2001 Guillaume Morin <gmorin@gnu.org>


(C) 2007 Kahlil (Kal) Hodgson <kahlil@internode.on.net>


(C) 2011 Adam Spiers <stow@adamspiers.org>

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.


Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
section entitled "GNU General Public License" is included with the
modified manual, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
one.

Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by the Free Software Foundation. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Types And Syntax Of Ignore Lists (Stow)</title>

<meta name="description" content="Types And Syntax Of Ignore Lists (Stow)">
<meta name="keywords" content="Types And Syntax Of Ignore Lists (Stow)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Ignore-Lists.html#Ignore-Lists" rel="up" title="Ignore Lists">
<link href="Justification-For-Yet-Another-Set-Of-Ignore-Files.html#Justification-For-Yet-Another-Set-Of-Ignore-Files" rel="next" title="Justification For Yet Another Set Of Ignore Files">
<link href="Motivation-For-Ignore-Lists.html#Motivation-For-Ignore-Lists" rel="prev" title="Motivation For Ignore Lists">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en">
<a name="Types-And-Syntax-Of-Ignore-Lists"></a>
<div class="header">
<p>
Next: <a href="Justification-For-Yet-Another-Set-Of-Ignore-Files.html#Justification-For-Yet-Another-Set-Of-Ignore-Files" accesskey="n" rel="next">Justification For Yet Another Set Of Ignore Files</a>, Previous: <a href="Motivation-For-Ignore-Lists.html#Motivation-For-Ignore-Lists" accesskey="p" rel="prev">Motivation For Ignore Lists</a>, Up: <a href="Ignore-Lists.html#Ignore-Lists" accesskey="u" rel="up">Ignore Lists</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Types-And-Syntax-Of-Ignore-Lists-1"></a>
<h3 class="section">4.2 Types And Syntax Of Ignore Lists</h3>

<p>If you put Perl regular expressions, one per line, in a
<samp>.stow-local-ignore</samp> file within any top level package directory,
in which case any file or directory within that package matching any
of these regular expressions will be ignored.  In the absence of this
package-specific ignore list, Stow will instead use the contents of
<samp>~/.stow-global-ignore</samp>, if it exists.  If neither the
package-local or global ignore list exist, Stow will use its own
built-in default ignore list, which serves as a useful example of the
format of these ignore list files:
</p>
<div class="example">
<pre class="verbatim"># Comments and blank lines are allowed.

RCS
.+,v

CVS
\.\#.+       # CVS conflict files / emacs lock files
\.cvsignore

\.svn
_darcs
\.hg

\.git
\.gitignore

.+~          # emacs backup files
\#.*\#       # emacs autosave files

^/README.*
^/LICENSE.*
^/COPYING
</pre></div>

<p>Stow first iterates through the chosen ignore list (built-in, global,
or package-local) as per above, stripping out comments (if you want to
include the &lsquo;<samp>#</samp>&rsquo; symbol in a regular expression, escape it with a
blackslash) and blank lines, placing each regular expressions into one
of two sets depending on whether it contains the &lsquo;<samp>/</samp>&rsquo; forward
slash symbol.
</p>
<p>Then in order to determine whether a file or directory should be
ignored:
</p>
<ol>
<li> Stow calculates its path relative to the top-level package directory,
prefixing that with &lsquo;<samp>/</samp>&rsquo;.  If any of the regular expressions
containing a &lsquo;<samp>/</samp>&rsquo; <em>exactly</em><a name="DOCF4" href="#FOOT4"><sup>4</sup></a> match
a subpath<a name="DOCF5" href="#FOOT5"><sup>5</sup></a> of this relative path, then the file or
directory will be ignored.

</li><li> If none of the regular expressions containing a &lsquo;<samp>/</samp>&rsquo; match in the
manner described above, Stow checks whether the
<em>basename</em><a name="DOCF6" href="#FOOT6"><sup>6</sup></a> of the file or directory matches
<em>exactly</em> against the remaining regular expressions which do not
contain a &lsquo;<samp>/</samp>&rsquo;, and if so, ignores the file or directory.

</li><li> Otherwise, the file or directory is not ignored.
</li></ol>


<p>For example, if a file <samp>bazqux</samp> is in the <samp>foo/bar</samp>
subdirectory of the package directory, Stow would use
&lsquo;<samp>/foo/bar/bazqux</samp>&rsquo; as the text for matching against regular
expressions which contain &lsquo;<samp>/</samp>&rsquo;, and &lsquo;<samp>bazqux</samp>&rsquo; as the text for
matching against regular expressions which don&rsquo;t contain &lsquo;<samp>/</samp>&rsquo;.
Then regular expressions &lsquo;<samp>bazqux</samp>&rsquo;, &lsquo;<samp>baz.*</samp>&rsquo;, &lsquo;<samp>.*qux</samp>&rsquo;,
&lsquo;<samp>bar/.*x</samp>&rsquo;, and &lsquo;<samp>^/foo/.*qux</samp>&rsquo; would all match (causing the
file to be ignored), whereas &lsquo;<samp>bar</samp>&rsquo;, &lsquo;<samp>baz</samp>&rsquo;, &lsquo;<samp>qux</samp>&rsquo;, and
&lsquo;<samp>o/bar/b</samp>&rsquo; would not (although &lsquo;<samp>bar</samp>&rsquo; would cause its parent
directory to be ignored and prevent Stow from recursing into that
anyway, in which case the file <samp>bazqux</samp> would not even be
considered for stowing).
</p>
<p>As a special exception to the above algorithm, any
<samp>.stow-local-ignore</samp> present in the top-level package directory
is <em>always</em> ignored, regardless of the contents of any ignore
list, because this file serves no purpose outside the stow directory.
</p>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>

<h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
<p>Exact matching means the
regular expression is anchored at the beginning and end, in contrast
to unanchored regular expressions which will match a substring.</p>
<h3><a name="FOOT5" href="#DOCF5">(5)</a></h3>
<p>In this context, &ldquo;subpath&rdquo; means a contiguous
subset of path segments; e.g for the relative path
<samp>one/two/three</samp>, there are six valid subpaths: <samp>one</samp>,
<samp>two</samp>, <samp>three</samp>, <samp>one/two</samp>, <samp>two/three</samp>,
<samp>one/two/three</samp>.</p>
<h3><a name="FOOT6" href="#DOCF6">(6)</a></h3>
<p>The &ldquo;basename&rdquo; is the name of the file or
directory itself, excluding any directory path prefix - as returned by
the <code>basename</code> command.</p>
</div>
<hr>
<div class="header">
<p>
Next: <a href="Justification-For-Yet-Another-Set-Of-Ignore-Files.html#Justification-For-Yet-Another-Set-Of-Ignore-Files" accesskey="n" rel="next">Justification For Yet Another Set Of Ignore Files</a>, Previous: <a href="Motivation-For-Ignore-Lists.html#Motivation-For-Ignore-Lists" accesskey="p" rel="prev">Motivation For Ignore Lists</a>, Up: <a href="Ignore-Lists.html#Ignore-Lists" accesskey="u" rel="up">Ignore Lists</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
